package com.firstjianmo.fragmentbestpractice;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.Window;

import com.firstjianmo.fragmentbestpractice.fragment.NewsContentFragment;
import com.firstjianmo.fragmentbestpractice.model.News;

/**
 * Created by pc on 2016/12/3.
 */

public class NewsContentActivity extends Activity {

    public static void actionStart(Context context, News news){
        Intent intent = new Intent(context, NewsContentActivity.class);
        intent.putExtra("news", news);
        context.startActivity(intent);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.news_content);
        News news = getIntent().getParcelableExtra("news");
        NewsContentFragment newsContentFragment = (NewsContentFragment) getFragmentManager().findFragmentById(R.id.news_content_fragment);
        newsContentFragment.refresh(news);

    }
}
